import 'package:flutter_demo3/entity/user_entity.dart';

userEntityFromJson(UserEntity data, Map<String, dynamic> json) {
	if (json['data'] != null) {
		data.data = new UserData().fromJson(json['data']);
	}
	if (json['success'] != null) {
		data.success = json['success'];
	}
	if (json['massage'] != null) {
		data.massage = json['massage']?.toString();
	}
	return data;
}

Map<String, dynamic> userEntityToJson(UserEntity entity) {
	final Map<String, dynamic> data = new Map<String, dynamic>();
	if (entity.data != null) {
		data['data'] = entity.data.toJson();
	}
	data['success'] = entity.success;
	data['massage'] = entity.massage;
	return data;
}

userDataFromJson(UserData data, Map<String, dynamic> json) {
	if (json['id'] != null) {
		data.id = json['id']?.toInt();
	}
	if (json['name'] != null) {
		data.name = json['name']?.toString();
	}
	if (json['password'] != null) {
		data.password = json['password']?.toString();
	}
	if (json['phone'] != null) {
		data.phone = json['phone']?.toString();
	}
	if (json['address'] != null) {
		data.address = json['address']?.toString();
	}
	if (json['headImg'] != null) {
		data.headImg = json['headImg']?.toString();
	}
	return data;
}

Map<String, dynamic> userDataToJson(UserData entity) {
	final Map<String, dynamic> data = new Map<String, dynamic>();
	data['id'] = entity.id;
	data['name'] = entity.name;
	data['password'] = entity.password;
	data['phone'] = entity.phone;
	data['address'] = entity.address;
	data['headImg'] = entity.headImg;
	return data;
}